<template>
  <div class="DialogNickname">
    <el-dialog :visible.sync="dialogVisible" width="500px" :close-on-click-modal="false" :close-on-press-escape	='false'
               title="选择插入昵称位置" center>
      <el-checkbox-group v-model="checkList">
        <el-checkbox label="插入到主题"></el-checkbox>
        <el-checkbox label="插入到正文"></el-checkbox>
      </el-checkbox-group>
      <!-- 底部按钮-->
      <div slot="footer" class="dialog-footer" align="right">
        <el-button @click="dialogVisible = false" size="mini">取 消</el-button>
        <el-button type="primary" size="mini" @click="submit">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
    export default {
        name: "DialogNickname",
        data() {
            return {
                dialogVisible: false,
                checkList: []
            }
        },
        methods: {
            submit() {
                if(this.getNickname()){
                    this.bus.$emit('titleNickname')
                }
                this.$emit('getDialogInfo', "#nickname#")
                this.dialogVisible = false;
            },
            getNickname(){
                let state=false;
                this.checkList.map(item=>{
                    if(item==='插入到主题'){
                        state=true;
                    }
                })
                return state;
            },
            //初始化
            init() {
                this.checkList = ['插入到主题'];
                this.dialogVisible = true;
            },
        }
    }
</script>

<style  lang="scss">
  .DialogNickname{
    .el-dialog__body {
      height: 180px;
      text-align: center;
      line-height: 160px;

      .el-checkbox-group {
        text-align: center;

        .el-checkbox {
          margin-right: 43px;
        }
      }
    }
  }

</style>
